<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/unbind-bankcard.css">
<style type="text/css">
.footer{
    display: none;
}
</style>
</block>
<block name="main">
    <div class="form">
        <div class="form-group">
            <div class="left">
                <span>手机号码</span>
            </div>
            <div class="right">
                <span>{:hidtel($user_info[user_phone])}</span>
            </div>
        </div>
        <div class="form-group">
            <input type="text" class="phone-text" id="code" placeholder="请输入验证码">
            <div class="phone-text-wrapper">
                <button class="get-verify-code" onClick='get_code()'>获取验证码</button>
            </div>
        </div>
    </div>
    <div class="btn-wrapper">
        <a href="javascript:" onclick="sub()">保存</a>
    </div>
</block>
<block name="js">
<script type="text/javascript">
function get_code(){
    var phone = "{$user_info.user_phone}";
    $.post('{:U("Person/unbind_bank_end")}',{
        phone:phone,
    },function(res){

    })
}

function sub(){
    var code = $('#code').val();
    $.post("{:U('Person/un_bind_bank')}",{
        code:code,
    },function(res){
        if(res.err==0){
            location.href="/Home/Person/unbind_bank_success"
        }else{
            location.href="/Home/Person/unbind_bank_error/msg/"+res.msg
        }
    })
}
</script>
</block>